package com.android.telephonecall;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.android.telephonecall.service.MainService;
import com.android.telephonecall.utils.AppDelegate;
import com.android.telephonecall.utils.DeviceInfoManager;


/**
 * 应用代理
 */
public class TeApplication extends Application {

    private static final String TAG = "HDApplication";

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        Log.d(TAG, "attachBaseContext: ");
        AppDelegate.init(this);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        initialize();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
    }

    private void initialize() {
        // 初始化配置
        initConfig();
        // 启动服务
        startServices();
    }

    /**
     * 启动服务
     */
    private void startServices() {
        // 启动守护服务
//        startService(new Intent(this, MainService.class));
    }

    /**
     * 初始化配置
     */
    private void initConfig() {
        // 初始化设备信息
        DeviceInfoManager.getInstance().initDeviceInfo(this);
    }
}
